﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SanFranciscoModel.Docente;
namespace SanFrancisco
{
    public partial class ReporteDocenteHorariosLibres : Form
    {
        public ReporteDocenteHorariosLibres()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ReporteDocenteHorariosLibres_Load(object sender, EventArgs e)
        {
            CargarDocentes();
            CargarGrilla();
        }

        private void CargarDocentes()
        {
            
            DocenteDataContext d = new DocenteDataContext();
            cmbDocente.DisplayMember = "Docente";
            cmbDocente.ValueMember = "DNIDocente";
            cmbDocente.DataSource = d.DocentesTodos();
        }

        private void CargarGrilla()
        {
            DocenteDataContext d = new DocenteDataContext();
            gridDocente.AutoGenerateColumns = false;
            gridDocente.DataSource = d.DocenteHorariosLibres((int)cmbDocente.SelectedValue);
        }

        private void cmbDocente_SelectedIndexChanged(object sender, EventArgs e)
        {
            CargarGrilla();
        }

    }
}
